<?php
/**
 * The loop that displays a page.
 *
 * The loop displays the posts and the post content. See
 * http://codex.wordpress.org/The_Loop to understand it and
 * http://codex.wordpress.org/Template_Tags to understand
 * the tags used in it.
 *
 * This can be overridden in child themes with loop-page.php.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.2
 */
 global $client_metabox;
	
?>

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
				<?php $meta = get_post_meta(get_the_ID(), $client_metabox->get_the_id(), TRUE); ?>
				<?php 
					$imgfeatured = get_post_meta(get_the_ID(), '_client_featured_img_meta', FALSE); 
				?>
				<?php //echo '<pre>';print_r($meta);echo '</pre>';?>
				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
				
					<div class="clients_menu group">
					
						
							<div class="clients_menu_thumb group left">
								<img src="<?php bloginfo( 'template_url' ); ?>/images/icon_pc.png" alt="clients website"  /> 
								<?php if( $meta['websiteurl'] ){ ?> 
								<a href="<?php echo $meta['websiteurl'];?>" target="_blank">Clients Website</a> 
								<?php } else{ ?>
								Clients Website
								<?php } ?>
							</div>
						
						
						
							<div class="clients_menu_thumb border_left group left">
								<img src="<?php bloginfo( 'template_url' ); ?>/images/icon_photo.png" alt="clients photo"  />
								<?php if( $meta['clientphoto'] ){ ?> 
								<a href="<?php echo get_permalink($meta['clientphoto']);?>">Clients Photo</a> 
								<?php } else{ ?>
								Clients Photo
								<?php } ?>
							</div>
						
						
						
							<div class="clients_menu_thumb border_left group left">
								<img src="<?php bloginfo( 'template_url' ); ?>/images/icon_video.png" alt="clients video"  /> 
								<?php if( $meta['video'] ){ ?>
								<a href="<?php echo $meta['video'];?>" target="_blank">Clients Video</a> 
								<?php } else{ ?>
								Clients Video
								<?php } ?>
							</div>
						
						
						
							<div class="clients_menu_thumb border_left group left">
								<img src="<?php bloginfo( 'template_url' ); ?>/images/icon_clients.png" alt="clients appearances"  /> 
								<?php if( $meta['clientappearances'] ){ ?>
								<a href="<?php echo get_permalink($meta['clientappearances']);?>">Clients Appearances</a> 
								<?php } else{ ?>
								Clients Appearances
								<?php } ?>
							</div>
						
						
						
							<div class="clients_menu_thumb border_left group left">
								<img src="<?php bloginfo( 'template_url' ); ?>/images/icon_print.png" alt="clients print media"  /> 
								<?php if( $meta['clientprints'] ){ ?>
								<a href="<?php echo get_permalink($meta['clientprints']);?>">Clients Prints / Media</a> 
								<?php } else{ ?>
								Clients Prints / Media
								<?php } ?>
							</div>
						
						
					</div>
					
					<div class="group">
						<div class="clients_page_column1 left">
							<?php if( $imgfeatured[0]['docs'][0]['fileurl'] ){ ?>
									<img src="<?php echo $imgfeatured[0]['docs'][0]['fileurl']; ?>" alt="clients print media"  />
							<?php 
							} 
							else{
							?>
								<img src="<?php bloginfo( 'template_url' ); ?>/images/clients_no_photo.jpg" alt="clients print media"  />
							<?php
							}
							?>
						</div>
						<div class="clients_page_column2 right">
							 <?php if ( is_front_page() ) { ?><h2 class="entry-title"><?php the_title(); ?></h2><?php } 
								  else { ?><h1 class="clients_title entry-title"><?php the_title(); ?></h1><?php }
							 ?>
		
							<div class="entry-content">
								<!-- second featured image -->
								<?php
								//if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
								//the_post_thumbnail();
								//} 
								?>
								<?php the_content(); ?>
								
								<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
								<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
							</div><!-- .entry-content -->
						</div>
					</div>
					
				</div><!-- #post-## -->

				<?php //comments_template( '', true ); ?>

<?php endwhile; // end of the loop. ?>
